<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of PriceHistoryAction
 *
 * @author Levz
 */
class PriceHistoryAction extends CAction {

    public function run() {
        if ($_GET['cid'] != null) {
            $dataProvider = new CActiveDataProvider('Price', array(
                        'criteria' => array(
                            'condition' => 'crop_id=:cropId',
                            'order' => 'timestamp DESC',
                            'with' => array('crop'),
                            'params' => array(':cropId' => $_GET['cid']),
                        ),
                        'pagination' => array(
                            'pageSize' => 50,
                        ),
                    ));

            $this->controller->render('pricehistory', array(
                'dataProvider' => $dataProvider,
            ));
        }
    }

}

?>
